/**
 * Copyright(c) Yystar Technology Co.,Ltd
 * project：security
 * package：com.yystar.security.op.controller
 * fileName：UserController.java
 * date：2013-6-27
 */
package com.yystar.security.op.controller;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yystar.security.op.service.UserService;
import com.yystar.security.support.base.BaseController;
import com.yystar.security.support.jdbc.Order;

/**
 * @author Vistaa Peng
 * @date 2013-6-27
 * @todo TODO
 * @modify	<BR>
 * 1.2013-6-27 Vistaa Peng Create file.
 */
@Controller
@RequestMapping("user")
public class UserController extends BaseController {
//	private final Logger log = LoggerFactory.getLogger(getClass());
	
	@Resource
	private UserService userService;
	
	@RequestMapping("/list")
	public String getUsers(Model model) {
		model.addAttribute("users", userService.getUsers());
		return "user/index";
	}
	
	@RequestMapping("/login")
	public String toLoginPage() {
		return "login";
	}
	
	@RequestMapping("/main")
	public String toMainPage() {
		return "main";
	}
	
	@RequestMapping("/accessDenied")
	public String toAccessDeniedPage() {
		return "access_denied";
	}

	/* (non-Javadoc)
	 * @see com.yystar.security.support.base.BaseController#initOrders()
	 */
	@Override
	public List<Order> initOrders() {
		List<Order> orders = new ArrayList<Order>();
		Order order = new Order();
		order.setName("userId");
		order.setSort("asc");
		return orders;
	}

}
